package main

import (
	"fmt"
	"sync"
	"time"
)

var wg sync.WaitGroup

func test() {
	for i := 0; i < 5000; i++ {
		fmt.Println("test() 你好 golang", i)
		time.Sleep(time.Millisecond * 100)
	}
	wg.Done()
}

func main() {

	wg.Add(1)
	go test() // 开启协程
	for i := 0; i < 6; i++ {
		fmt.Println("main() 你好 golang", i)
		time.Sleep(time.Millisecond * 100)
	}
	wg.Wait()
	//time.Sleep(time.Second)

}
